package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class wangye extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_wangye);

        Intent intent = getIntent();
        String url = "";
        switch (intent.getStringExtra("key")){
            case "历史":
                url="https://www.lishiwenku.com/";
                break;
            case "名族":
                url="https://zhidao.baidu.com/question/281399199.html";
                break;
            case "热点":
                url="http://live.nbd.com.cn/";
                break;
        }
        WebView webView;
        webView =(WebView)findViewById(R.id.web) ;
        webView.loadUrl(url);  //加载网页
        webView.setWebViewClient(new WebViewClient());//锁死页面
        webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);//适应屏幕，内容将自动缩放
        webView.getSettings().setUseWideViewPort(true);
        webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);//适应内容大小
        webView.getSettings().setLoadWithOverviewMode(true);
    }
}